package org.starsource.forum.server.transaction;

import java.util.Set;

import org.starsource.forum.client.exception.DatabaseException;
import org.starsource.forum.client.exception.MessageNotFoundException;
import org.starsource.forum.client.exception.PermissionDeniedException;
import org.starsource.forum.client.exception.ResourceNotFoundException;
import org.starsource.forum.client.exception.SessionNotFoundException;
import org.starsource.forum.server.domain.Category;
import org.starsource.forum.server.domain.Message;
import org.starsource.forum.server.domain.Resource;
import org.starsource.forum.server.domain.Session;
import org.starsource.forum.server.domain.User;

public interface MessengerTransaction {

	public Session	createSession(User requester, String title, String content, Category category) throws DatabaseException;

	public Message	followSession(User requester, String content, Session session) throws DatabaseException;

	public void		updateSession(User requester, Session session) throws DatabaseException;

	public void		removeSession(User requester, Session session) throws PermissionDeniedException, DatabaseException;

	public void		updateMessage(User requester, Message message) throws DatabaseException;

	public void		removeMessage(User requester, Message message) throws MessageNotFoundException, DatabaseException;

	public Resource addResource(User requester, String url, String thumbUrl, int width, int height, Message message) throws DatabaseException;

	public void		removeResource(User requester, Resource resource) throws ResourceNotFoundException, DatabaseException;

	public Resource	getResource(User requester, int id) throws ResourceNotFoundException, DatabaseException;

	public Session	getSession(User requester, int id) throws SessionNotFoundException, DatabaseException;

	public Message	getMessage(User requester, int id) throws MessageNotFoundException, DatabaseException;

	public Set<Session> getSessionSet(User requester) throws DatabaseException;

	public Set<Session> getSessionSet(User requester, Category category) throws DatabaseException;

	public Set<Session> getSessionSet(User requester, Set<Category> categories) throws DatabaseException;

	public Set<Session> getSessionSetByKeywords(User requester, String[] keywords) throws DatabaseException;

}
